package com.yiyang.cloud.dao;

import com.yiyang.cloud.entity.User;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@Service
public class UserRepository {

    private static final Map<Long, User> USER_MAP = new HashMap<Long, User>();

    static {
        USER_MAP.put(1L, new User(1L, "user1", "user1", 12, new BigDecimal(100)));
        USER_MAP.put(2L, new User(2L, "user2", "user2", 12, new BigDecimal(200)));
        USER_MAP.put(3L, new User(3L, "user3", "user3", 12, new BigDecimal(300)));
        USER_MAP.put(4L, new User(4L, "user4", "user4", 12, new BigDecimal(400)));
        USER_MAP.put(5L, new User(5L, "user5", "user5", 12, new BigDecimal(500)));
    }

    public User findByUserId(Long id) {
        return USER_MAP.get(id);
    }
}
